<?php
// 测试admin模块是否可访问
$host = '127.0.0.1';
$port = 3306;
$database = 'qiandao';
$username = 'root';
$password = 'root';

try {
    $pdo = new PDO("mysql:host={$host};port={$port};dbname={$database};charset=utf8mb4", $username, $password);
    $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    
    echo "=== 检查菜单的node字段 ===\n\n";
    
    // 检查admin模块的菜单
    $stmt = $pdo->query("SELECT id, title, node, url FROM system_menu WHERE node LIKE 'admin/%' OR node LIKE 'plugin-admin%'");
    $adminMenus = $stmt->fetchAll(PDO::FETCH_ASSOC);
    
    echo "Admin模块菜单数量: " . count($adminMenus) . "\n\n";
    foreach ($adminMenus as $menu) {
        echo "ID:{$menu['id']} {$menu['title']} - node:{$menu['node']}\n";
    }
    
    echo "\n=== 检查wechat模块的菜单 ===\n\n";
    
    // 检查wechat模块的菜单
    $stmt = $pdo->query("SELECT id, title, node, url FROM system_menu WHERE node LIKE 'wechat/%' OR node LIKE 'plugin-wechat%'");
    $wechatMenus = $stmt->fetchAll(PDO::FETCH_ASSOC);
    
    echo "Wechat模块菜单数量: " . count($wechatMenus) . "\n\n";
    foreach ($wechatMenus as $menu) {
        echo "ID:{$menu['id']} {$menu['title']} - node:{$menu['node']}\n";
    }
    
    echo "\n=== 建议 ===\n\n";
    echo "如果admin模块的node是 'admin/xxx'，而wechat模块的node是 'wechat/xxx'，\n";
    echo "那么可能需要将admin模块的node改为 'plugin-admin/xxx' 格式\n";
    
} catch (PDOException $e) {
    echo "错误: " . $e->getMessage() . "\n";
}

